#pragma once

#define Packet_Prefix 0x20129011

struct Head
{
	int nPrefiex;
	int nSize;
	int nType;
};
struct SimpleBuf;

class Packet
{
public:
	static Packet* Create(int nType);
	int GetType()const {return m_type;}
protected:
	enum
	{
		Type_Msg,
	};
	int m_type;

public:
	virtual bool write(SimpleBuf& pBuf);
	virtual bool read(SimpleBuf& pBuf);
	virtual void process();
};

class PacketMsg : public Packet
{
public:
	PacketMsg();
	virtual bool write(SimpleBuf& pBuf);
	virtual bool read(SimpleBuf& pBuf);
	virtual void process();
	void SetMsg(const char* pMsg);
private:
	char szMsg[32];
};